#include "data_source.h"
#include <fstream>
#include <iostream>
#include <boost/format.hpp>


std::shared_ptr<YYPointsType> readTriangles(const std::string& filename)
{
	std::shared_ptr<YYPointsType> points{ new YYPointsType };
	std::ifstream fcin{ filename };
	const boost::format format_template("%.3f,%.3f,%.3f\n");

	double x = 0, y = 0, z = 0;
	while (fcin >> x >> y >> z)
	{
		YYPointType point;
		point[0] = x;
		point[1] = y;
		point[2] = z;
		points->push_back(point);
		//std::cout << (boost::format(format_template) % x % y % z).str();
	}
	//for (auto& pt1 : *points)
	//{
	//	auto& pt = *pt1;
	//	std::cout << (boost::format(format_template) % pt[0] % pt[1] % pt[2]).str();
	//}
	return points;
}